package com.netease.image;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.DisplayMetrics;
import com.netease.g.b;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class c
{
  private static float a = 512000.0F;

  public static int a(Context paramContext, float paramFloat)
  {
    return (int)(0.5F + paramFloat * paramContext.getResources().getDisplayMetrics().density);
  }

  // ERROR //
  public static Bitmap a(Context paramContext, android.net.Uri paramUri, int paramInt1, int paramInt2)
  {
    // Byte code:
    //   0: aload_1
    //   1: ifnonnull +9 -> 10
    //   4: aconst_null
    //   5: astore 5
    //   7: aload 5
    //   9: areturn
    //   10: aload_0
    //   11: invokevirtual 42	android/content/Context:getContentResolver	()Landroid/content/ContentResolver;
    //   14: aload_1
    //   15: invokevirtual 48	android/content/ContentResolver:openInputStream	(Landroid/net/Uri;)Ljava/io/InputStream;
    //   18: astore 6
    //   20: new 50	android/graphics/BitmapFactory$Options
    //   23: dup
    //   24: invokespecial 51	android/graphics/BitmapFactory$Options:<init>	()V
    //   27: astore 7
    //   29: aload 7
    //   31: iconst_1
    //   32: putfield 55	android/graphics/BitmapFactory$Options:inJustDecodeBounds	Z
    //   35: aload 6
    //   37: aconst_null
    //   38: aload 7
    //   40: invokestatic 61	android/graphics/BitmapFactory:decodeStream	(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    //   43: astore 8
    //   45: aload 8
    //   47: ifnull +8 -> 55
    //   50: aload 8
    //   52: invokevirtual 66	android/graphics/Bitmap:recycle	()V
    //   55: aload 7
    //   57: iconst_0
    //   58: putfield 55	android/graphics/BitmapFactory$Options:inJustDecodeBounds	Z
    //   61: aload 6
    //   63: invokevirtual 71	java/io/InputStream:close	()V
    //   66: aload 7
    //   68: getfield 75	android/graphics/BitmapFactory$Options:outWidth	I
    //   71: i2f
    //   72: iload_2
    //   73: i2f
    //   74: fdiv
    //   75: fstore 10
    //   77: aload 7
    //   79: getfield 78	android/graphics/BitmapFactory$Options:outHeight	I
    //   82: i2f
    //   83: iload_3
    //   84: i2f
    //   85: fdiv
    //   86: fstore 11
    //   88: aload 7
    //   90: iconst_1
    //   91: putfield 81	android/graphics/BitmapFactory$Options:inSampleSize	I
    //   94: fload 10
    //   96: fconst_1
    //   97: fcmpl
    //   98: ifgt +10 -> 108
    //   101: fload 11
    //   103: fconst_1
    //   104: fcmpl
    //   105: ifle +22 -> 127
    //   108: fload 10
    //   110: fload 11
    //   112: fcmpl
    //   113: ifle +75 -> 188
    //   116: aload 7
    //   118: fload 10
    //   120: ldc 82
    //   122: fadd
    //   123: f2i
    //   124: putfield 81	android/graphics/BitmapFactory$Options:inSampleSize	I
    //   127: aload_0
    //   128: invokevirtual 42	android/content/Context:getContentResolver	()Landroid/content/ContentResolver;
    //   131: aload_1
    //   132: invokevirtual 48	android/content/ContentResolver:openInputStream	(Landroid/net/Uri;)Ljava/io/InputStream;
    //   135: astore 13
    //   137: aload 13
    //   139: aconst_null
    //   140: aload 7
    //   142: invokestatic 61	android/graphics/BitmapFactory:decodeStream	(Ljava/io/InputStream;Landroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    //   145: astore 5
    //   147: aload 13
    //   149: invokevirtual 71	java/io/InputStream:close	()V
    //   152: goto -145 -> 7
    //   155: astore 14
    //   157: aload 14
    //   159: invokevirtual 85	java/io/IOException:printStackTrace	()V
    //   162: goto -155 -> 7
    //   165: astore 4
    //   167: aload 4
    //   169: invokevirtual 86	java/io/FileNotFoundException:printStackTrace	()V
    //   172: aconst_null
    //   173: astore 5
    //   175: goto -168 -> 7
    //   178: astore 9
    //   180: aload 9
    //   182: invokevirtual 85	java/io/IOException:printStackTrace	()V
    //   185: goto -119 -> 66
    //   188: fload 11
    //   190: fstore 10
    //   192: goto -76 -> 116
    //   195: astore 12
    //   197: aload 12
    //   199: invokevirtual 86	java/io/FileNotFoundException:printStackTrace	()V
    //   202: aconst_null
    //   203: astore 5
    //   205: goto -198 -> 7
    //
    // Exception table:
    //   from	to	target	type
    //   147	152	155	java/io/IOException
    //   10	20	165	java/io/FileNotFoundException
    //   61	66	178	java/io/IOException
    //   127	137	195	java/io/FileNotFoundException
  }

  public static Bitmap a(Bitmap paramBitmap)
  {
    Bitmap localBitmap = null;
    if (paramBitmap == null);
    while (true)
    {
      return localBitmap;
      int i = paramBitmap.getWidth();
      int j = paramBitmap.getHeight();
      try
      {
        localBitmap = Bitmap.createBitmap(i, j, Bitmap.Config.ARGB_8888);
        Canvas localCanvas = new Canvas(localBitmap);
        Paint localPaint = new Paint();
        Rect localRect = new Rect(0, 0, i, j);
        RectF localRectF = new RectF(localRect);
        localPaint.setAntiAlias(true);
        localCanvas.drawARGB(0, 0, 0, 0);
        localPaint.setColor(-12434878);
        localCanvas.drawRoundRect(localRectF, 5.0F, 5.0F, localPaint);
        localPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
        localCanvas.drawBitmap(paramBitmap, localRect, localRect, localPaint);
        if (paramBitmap == null)
          continue;
        paramBitmap.recycle();
        continue;
      }
      catch (OutOfMemoryError localOutOfMemoryError)
      {
        localOutOfMemoryError.printStackTrace();
        if (paramBitmap == null)
          continue;
        paramBitmap.recycle();
        continue;
      }
      catch (NullPointerException localNullPointerException)
      {
        localNullPointerException.printStackTrace();
        if (paramBitmap == null)
          continue;
        paramBitmap.recycle();
        continue;
      }
      finally
      {
        if (paramBitmap != null)
          paramBitmap.recycle();
      }
    }
    throw localObject;
  }

  static Bitmap a(Bitmap paramBitmap, int paramInt)
  {
    Matrix localMatrix;
    if ((paramInt != 0) && (paramBitmap != null))
    {
      localMatrix = new Matrix();
      localMatrix.setRotate(paramInt, paramBitmap.getWidth() / 2.0F, paramBitmap.getHeight() / 2.0F);
    }
    try
    {
      int i = paramBitmap.getWidth();
      int j = paramBitmap.getHeight();
      Bitmap localBitmap = Bitmap.createBitmap(paramBitmap, 0, 0, i, j, localMatrix, true);
      if (paramBitmap != localBitmap)
      {
        paramBitmap.recycle();
        paramBitmap = localBitmap;
      }
      return paramBitmap;
    }
    catch (OutOfMemoryError localOutOfMemoryError)
    {
      while (true)
        localOutOfMemoryError.printStackTrace();
    }
  }

  public static Bitmap a(Bitmap paramBitmap, int paramInt1, int paramInt2)
  {
    Bitmap localBitmap;
    if (paramBitmap == null)
    {
      localBitmap = null;
      return localBitmap;
    }
    int i = paramBitmap.getWidth();
    int j = paramBitmap.getHeight();
    float f1 = paramInt1 / i;
    float f2 = paramInt2 / j;
    if (f1 < f2);
    while (true)
    {
      Matrix localMatrix = new Matrix();
      localMatrix.postScale(f2, f2);
      localBitmap = Bitmap.createBitmap(paramBitmap, 0, 0, i, j, localMatrix, true);
      break;
      f2 = f1;
    }
  }

  public static Bitmap a(String paramString)
  {
    Object localObject = null;
    if (paramString == null);
    while (true)
    {
      return localObject;
      File localFile = new File(paramString);
      if ((!localFile.isFile()) || (!localFile.exists()))
        continue;
      float f = (float)localFile.length() / a;
      BitmapFactory.Options localOptions = new BitmapFactory.Options();
      localOptions.inJustDecodeBounds = false;
      localOptions.inSampleSize = 1;
      if (f > 1.0F)
        localOptions.inSampleSize = (int)(f + 0.5F);
      try
      {
        Bitmap localBitmap = BitmapFactory.decodeFile(paramString, localOptions);
        localObject = localBitmap;
      }
      catch (OutOfMemoryError localOutOfMemoryError)
      {
        localOutOfMemoryError.printStackTrace();
        b.c("getBitmapFromFileLimitSize", "OutOfMemoryError");
      }
    }
  }

  // ERROR //
  public static Bitmap a(String paramString, int paramInt1, int paramInt2)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_3
    //   2: aload_0
    //   3: ifnonnull +5 -> 8
    //   6: aload_3
    //   7: areturn
    //   8: new 50	android/graphics/BitmapFactory$Options
    //   11: dup
    //   12: invokespecial 51	android/graphics/BitmapFactory$Options:<init>	()V
    //   15: astore 4
    //   17: aload 4
    //   19: iconst_1
    //   20: putfield 55	android/graphics/BitmapFactory$Options:inJustDecodeBounds	Z
    //   23: aload_0
    //   24: aload 4
    //   26: invokestatic 201	android/graphics/BitmapFactory:decodeFile	(Ljava/lang/String;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    //   29: astore 6
    //   31: aload 6
    //   33: astore 7
    //   35: aload 7
    //   37: ifnull +11 -> 48
    //   40: aload 7
    //   42: invokevirtual 66	android/graphics/Bitmap:recycle	()V
    //   45: aconst_null
    //   46: astore 7
    //   48: aload 4
    //   50: iconst_0
    //   51: putfield 55	android/graphics/BitmapFactory$Options:inJustDecodeBounds	Z
    //   54: aload 4
    //   56: getfield 75	android/graphics/BitmapFactory$Options:outWidth	I
    //   59: i2f
    //   60: iload_1
    //   61: i2f
    //   62: fdiv
    //   63: fstore 9
    //   65: aload 4
    //   67: getfield 78	android/graphics/BitmapFactory$Options:outHeight	I
    //   70: i2f
    //   71: iload_2
    //   72: i2f
    //   73: fdiv
    //   74: fstore 10
    //   76: aload 4
    //   78: iconst_1
    //   79: putfield 81	android/graphics/BitmapFactory$Options:inSampleSize	I
    //   82: fload 9
    //   84: fconst_1
    //   85: fcmpl
    //   86: ifgt +67 -> 153
    //   89: fload 10
    //   91: fconst_1
    //   92: fcmpl
    //   93: ifle +17 -> 110
    //   96: goto +57 -> 153
    //   99: aload 4
    //   101: fload 9
    //   103: ldc 82
    //   105: fadd
    //   106: f2i
    //   107: putfield 81	android/graphics/BitmapFactory$Options:inSampleSize	I
    //   110: aload_0
    //   111: aload 4
    //   113: invokestatic 201	android/graphics/BitmapFactory:decodeFile	(Ljava/lang/String;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;
    //   116: astore 11
    //   118: aload 11
    //   120: astore_3
    //   121: goto -115 -> 6
    //   124: fload 10
    //   126: fstore 9
    //   128: goto -29 -> 99
    //   131: astore 5
    //   133: aload 5
    //   135: invokevirtual 163	java/lang/OutOfMemoryError:printStackTrace	()V
    //   138: goto -132 -> 6
    //   141: astore 8
    //   143: aload 7
    //   145: astore_3
    //   146: aload 8
    //   148: astore 5
    //   150: goto -17 -> 133
    //   153: fload 9
    //   155: fload 10
    //   157: fcmpl
    //   158: ifle -34 -> 124
    //   161: goto -62 -> 99
    //
    // Exception table:
    //   from	to	target	type
    //   8	31	131	java/lang/OutOfMemoryError
    //   40	118	141	java/lang/OutOfMemoryError
  }

  public static boolean a(Bitmap paramBitmap, String paramString, Bitmap.CompressFormat paramCompressFormat)
  {
    boolean bool = false;
    try
    {
      if (!new File(paramString).exists())
        new File(paramString).createNewFile();
      FileOutputStream localFileOutputStream = new FileOutputStream(paramString);
      bool = paramBitmap.compress(paramCompressFormat, 100, localFileOutputStream);
      return bool;
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      while (true)
        localFileNotFoundException.printStackTrace();
    }
    catch (IOException localIOException)
    {
      while (true)
        localIOException.printStackTrace();
    }
  }

  public static int b(Context paramContext, float paramFloat)
  {
    return (int)(0.5F + paramFloat / paramContext.getResources().getDisplayMetrics().density);
  }

  // ERROR //
  public static Bitmap b(Bitmap paramBitmap)
  {
    // Byte code:
    //   0: aload_0
    //   1: ifnonnull +9 -> 10
    //   4: aconst_null
    //   5: astore 6
    //   7: aload 6
    //   9: areturn
    //   10: aload_0
    //   11: invokevirtual 95	android/graphics/Bitmap:getWidth	()I
    //   14: istore_1
    //   15: aload_0
    //   16: invokevirtual 98	android/graphics/Bitmap:getHeight	()I
    //   19: istore_2
    //   20: iload_1
    //   21: iload_2
    //   22: getstatic 104	android/graphics/Bitmap$Config:ARGB_8888	Landroid/graphics/Bitmap$Config;
    //   25: invokestatic 108	android/graphics/Bitmap:createBitmap	(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;
    //   28: astore 9
    //   30: aload 9
    //   32: astore 6
    //   34: new 110	android/graphics/Canvas
    //   37: dup
    //   38: aload 6
    //   40: invokespecial 113	android/graphics/Canvas:<init>	(Landroid/graphics/Bitmap;)V
    //   43: astore 10
    //   45: new 115	android/graphics/Paint
    //   48: dup
    //   49: invokespecial 116	android/graphics/Paint:<init>	()V
    //   52: astore 11
    //   54: new 118	android/graphics/Rect
    //   57: dup
    //   58: iconst_0
    //   59: iconst_0
    //   60: iload_1
    //   61: iload_2
    //   62: invokespecial 121	android/graphics/Rect:<init>	(IIII)V
    //   65: astore 12
    //   67: new 123	android/graphics/RectF
    //   70: dup
    //   71: aload 12
    //   73: invokespecial 126	android/graphics/RectF:<init>	(Landroid/graphics/Rect;)V
    //   76: astore 13
    //   78: aload 11
    //   80: iconst_1
    //   81: invokevirtual 130	android/graphics/Paint:setAntiAlias	(Z)V
    //   84: aload 10
    //   86: iconst_0
    //   87: iconst_0
    //   88: iconst_0
    //   89: iconst_0
    //   90: invokevirtual 133	android/graphics/Canvas:drawARGB	(IIII)V
    //   93: aload 11
    //   95: ldc 134
    //   97: invokevirtual 138	android/graphics/Paint:setColor	(I)V
    //   100: aload 10
    //   102: aload 13
    //   104: ldc 139
    //   106: ldc 139
    //   108: aload 11
    //   110: invokevirtual 143	android/graphics/Canvas:drawRoundRect	(Landroid/graphics/RectF;FFLandroid/graphics/Paint;)V
    //   113: aload 11
    //   115: new 145	android/graphics/PorterDuffXfermode
    //   118: dup
    //   119: getstatic 151	android/graphics/PorterDuff$Mode:SRC_IN	Landroid/graphics/PorterDuff$Mode;
    //   122: invokespecial 154	android/graphics/PorterDuffXfermode:<init>	(Landroid/graphics/PorterDuff$Mode;)V
    //   125: invokevirtual 158	android/graphics/Paint:setXfermode	(Landroid/graphics/Xfermode;)Landroid/graphics/Xfermode;
    //   128: pop
    //   129: aload 10
    //   131: aload_0
    //   132: aload 12
    //   134: aload 12
    //   136: aload 11
    //   138: invokevirtual 162	android/graphics/Canvas:drawBitmap	(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Paint;)V
    //   141: aload_0
    //   142: ifnull -135 -> 7
    //   145: goto -138 -> 7
    //   148: astore 7
    //   150: aload 7
    //   152: astore 8
    //   154: aconst_null
    //   155: astore 6
    //   157: aload 6
    //   159: ifnull +11 -> 170
    //   162: aload 6
    //   164: invokevirtual 66	android/graphics/Bitmap:recycle	()V
    //   167: aconst_null
    //   168: astore 6
    //   170: aload 8
    //   172: invokevirtual 227	java/lang/RuntimeException:printStackTrace	()V
    //   175: aload_0
    //   176: ifnull -169 -> 7
    //   179: goto -172 -> 7
    //   182: aload 4
    //   184: invokevirtual 163	java/lang/OutOfMemoryError:printStackTrace	()V
    //   187: aload 5
    //   189: ifnull +43 -> 232
    //   192: aload 5
    //   194: invokevirtual 66	android/graphics/Bitmap:recycle	()V
    //   197: aconst_null
    //   198: astore 6
    //   200: aload_0
    //   201: ifnull -194 -> 7
    //   204: goto -197 -> 7
    //   207: astore_3
    //   208: aload_0
    //   209: ifnull +3 -> 212
    //   212: aload_3
    //   213: athrow
    //   214: astore 14
    //   216: aload 6
    //   218: astore 5
    //   220: aload 14
    //   222: astore 4
    //   224: goto -42 -> 182
    //   227: astore 8
    //   229: goto -72 -> 157
    //   232: aload 5
    //   234: astore 6
    //   236: goto -36 -> 200
    //   239: astore 4
    //   241: aconst_null
    //   242: astore 5
    //   244: goto -62 -> 182
    //
    // Exception table:
    //   from	to	target	type
    //   20	30	148	java/lang/RuntimeException
    //   20	30	207	finally
    //   34	141	207	finally
    //   162	197	207	finally
    //   34	141	214	java/lang/OutOfMemoryError
    //   34	141	227	java/lang/RuntimeException
    //   20	30	239	java/lang/OutOfMemoryError
  }

  public static Bitmap b(Bitmap paramBitmap, int paramInt1, int paramInt2)
  {
    Bitmap localBitmap;
    if (paramBitmap == null)
    {
      localBitmap = null;
      return localBitmap;
    }
    int i = paramBitmap.getWidth();
    int j = paramBitmap.getHeight();
    float f1 = paramInt1 / i;
    float f2 = paramInt2 / j;
    if (f1 < f2);
    while (true)
    {
      Matrix localMatrix = new Matrix();
      localMatrix.postScale(f2, f2);
      localBitmap = Bitmap.createBitmap(paramBitmap, 0, 0, i, j, localMatrix, true);
      if (localBitmap == paramBitmap)
        break;
      paramBitmap.recycle();
      break;
      f2 = f1;
    }
  }

  public static Bitmap c(Bitmap paramBitmap, int paramInt1, int paramInt2)
  {
    if (paramBitmap == null)
      paramBitmap = null;
    int i;
    int j;
    float f1;
    float f2;
    do
    {
      return paramBitmap;
      i = paramBitmap.getWidth();
      j = paramBitmap.getHeight();
      f1 = paramInt1 / i;
      f2 = paramInt2 / j;
    }
    while ((f1 >= 1.0F) && (f2 >= 1.0F));
    if (f1 < f2);
    while (true)
    {
      Matrix localMatrix = new Matrix();
      localMatrix.postScale(f1, f1);
      Bitmap localBitmap = Bitmap.createBitmap(paramBitmap, 0, 0, i, j, localMatrix, true);
      paramBitmap.recycle();
      paramBitmap = localBitmap;
      break;
      f1 = f2;
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.image.c
 * JD-Core Version:    0.6.0
 */